#ifndef __SIMPLE_TIP_CTRL_H__
#define __SIMPLE_TIP_CTRL_H__

#include "SimpleWnd.h"

/* CSimpleTipCtrl is not a Windows tooltip common control.
 *  Windows is used for static content, for example, fixed rectangle or child window.
 * CSimpleTipCtrl is used for dynamic cases, for example show tips for text.
 */
#define SIMPLETIP_CLASS _T("CZFSimpleTipCtrl")

#define DEFAULT_TIP_BKCOLOR (RGB(255,255,220))
#define DEFAULT_TIP_MARGIN (2)

class CSimpleTipCtrl : public CWnd
{
public:
   CSimpleTipCtrl();
   virtual ~CSimpleTipCtrl();

   DECLARE_WND_CLASS_EX(SIMPLETIP_CLASS, 0, NO_BACKGROUND)
   
   // Set the left top concer position, in screen coordinate.
   int SetText(const POINT* ptScr, LPCTSTR txt);
   void SetBkgrdColor(COLORREF clrBk);

   BEGIN_MSG_MAP(CSimpletipCtrl)
      MESSAGE_HANDLER(WM_PAINT, OnPaint)
      MESSAGE_HANDLER(WM_CREATE, OnCreate)
   END_MSG_MAP()

protected:
   LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
   LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

   void CalcTextSize(LPCTSTR txt, SIZE* size);
   TCHAR*   m_pszText;
   SIZE     m_sizeText;
   HBRUSH   m_brBack;
   int      m_nHMargin;
   int      m_nVMargin;
};

#endif
